package es.aa.android.cartomatic.implementations.da;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class SQLite extends SQLiteOpenHelper {

    protected SQLite(Context context, CursorFactory factory, int version) {
        super(context, SQLiteConstants.NAME, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(SQLiteConstants.CREATE_CARD);
        db.execSQL(SQLiteConstants.CREATE_DECK);
        db.execSQL(SQLiteConstants.CREATE_CARD_BELONG);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int lastVerion, int newVersion) {
        db.execSQL(SQLiteConstants.DELETE_CARDS);
        db.execSQL(SQLiteConstants.DELETE_DECKS);
        db.execSQL(SQLiteConstants.DELETE_CARD_BELONG);
        onCreate(db);
    }


}
